package leetcode.ge100;

import java.io.Serializable;

class ListNode implements Serializable {
    /**
     *
     */
    private static final long serialVersionUID = 1L;
    int val;
    ListNode next;

    ListNode(int x) {
        val = x;
    }


    @Override
    public String toString() {
        return next == null ? "" + val : "" + val + next.toString();
    }

    public ListNode append(int i) {
        this.next = new ListNode(i);
        return next;
    }

}